﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/Admin.master" AutoEventWireup="true" CodeFile="ThucDonSua.aspx.cs" Inherits="Admin_ThucDonSua" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="formBox">
<h2>Thông tin chi tiết - Thực đơn</h2>
   <div class="alignR" style="margin:5px 20px;">
       <asp:HyperLink ID="hplTrove" runat="server" NavigateUrl="~/Admin/ThucDon.aspx">Trở về</asp:HyperLink></div>
   
    <asp:DetailsView ID="dvwThucDon" runat="server" AutoGenerateRows="False" 
        DataKeyNames="SanPhamID" DataSourceID="DSThucDon" Width="98%" 
        GridLines="None" CellPadding="5">
        <CommandRowStyle HorizontalAlign="Right" CssClass="border-Top" Height="50px" 
            VerticalAlign="Bottom" />
        <FieldHeaderStyle Width="25%" Font-Bold="True" HorizontalAlign="Right" 
            VerticalAlign="Top" />
        <Fields>
            <asp:BoundField DataField="SanPhamID" HeaderText="Thực đơn ID" ReadOnly="True" 
                SortExpression="SanPhamID" />
            <asp:TemplateField HeaderText="Tên thực đơn" SortExpression="TenSanPham">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" MaxLength="100" 
                        Text='<%# Bind("TenSanPham") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="TextBox1" ErrorMessage="Tên thực đơn không được để trống!" 
                        ForeColor="Red">*</asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TenSanPham") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("TenSanPham") %>'></asp:Label>
                </ItemTemplate>
                <ControlStyle Width="90%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Đơn giá" SortExpression="DonGia">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("DonGia") %>'></asp:TextBox>
                    <asp:CompareValidator ID="CompareValidator2" runat="server" 
                        ControlToValidate="TextBox2" ErrorMessage="Đơn giá phải &gt;0" ForeColor="Red" 
                        Operator="GreaterThan" Type="Integer" ValueToCompare="0">*</asp:CompareValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" 
                        Text='<%# Bind("DonGia", "{0:#,##0}") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("DonGia", "{0:#,##0}") %>'></asp:Label>
                </ItemTemplate>
                <ControlStyle Width="40%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Khuyến mãi" SortExpression="KhuyenMai">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("KhuyenMai") %>'></asp:TextBox>
                    <asp:CompareValidator ID="CompareValidator4" runat="server" 
                        ControlToValidate="TextBox4" ErrorMessage="Khuyến mãi phải &gt;=0" 
                        ForeColor="Red" Operator="GreaterThanEqual" Type="Integer" ValueToCompare="0">*</asp:CompareValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("KhuyenMai") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("KhuyenMai") %>'></asp:Label>
                </ItemTemplate>
                <ControlStyle Width="40%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Ngày cập nhật" SortExpression="NgayCapNhat">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("NgayCapNhat", "{0:MM/dd/yyyy}") %>'></asp:TextBox>
                    <asp:CompareValidator ID="CompareValidator5" runat="server" 
                        ControlToValidate="TextBox5" ErrorMessage="Ngày cập nhật không hợp lệ!" 
                        ForeColor="Red" Operator="DataTypeCheck" Type="Date">*</asp:CompareValidator>
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                        ShowMessageBox="True" ShowSummary="False" />
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" 
                        Text='<%# Bind("NgayCapNhat") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" 
                        Text='<%# Bind("NgayCapNhat", "{0:MM/dd/yyyy}") %>'></asp:Label>
                </ItemTemplate>
                <ControlStyle Width="40%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Nhóm món" SortExpression="MaLoai">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlNhomMon" runat="server" DataSourceID="DSNhomMon" 
                        DataTextField="TenNhomMon" DataValueField="NhomMonID" 
                        SelectedValue='<%# Bind("MaLoai") %>' Width="40%">
                    </asp:DropDownList>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:DropDownList ID="ddlNhomMon" runat="server" DataSourceID="DSNhomMon" 
                        DataTextField="TenNhomMon" DataValueField="NhomMonID" 
                        SelectedValue='<%# Bind("MaLoai") %>' Width="40%" Enabled="False"> </asp:DropDownList>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Hình" SortExpression="Hinh">
                <EditItemTemplate>
                    <asp:FileUpload ID="FileUpload1" runat="server" Width="98%" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Hinh") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Mô tả" SortExpression="MoTa">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Rows="5" Text='<%# Bind("MoTa") %>' 
                        TextMode="MultiLine" Width="98%" BorderStyle="Solid" BorderColor="#999999" BorderWidth="1px" Height="75px"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" BorderStyle="Solid" ReadOnly="True" 
                        Rows="3" Text='<%# Bind("MoTa") %>' TextMode="MultiLine" Width="98%" BorderColor="#999999" BorderWidth="1px" Height="75px"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="BiDanh" HeaderText="Bí danh" 
                SortExpression="BiDanh" ReadOnly="True" />
            <asp:CheckBoxField DataField="NgungBan" HeaderText="Ngừng bán" 
                SortExpression="NgungBan" />
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ButtonType="Image" CancelText="Bỏ qua" DeleteText="Xóa" EditText="Sửa" 
                UpdateText="Cập nhật" CancelImageUrl="~/Images/undo2.png" 
                DeleteImageUrl="~/Images/delete2.png" EditImageUrl="~/Images/edit2.png" 
                UpdateImageUrl="~/Images/save2.png" >
            <ControlStyle Height="38px" />
            </asp:CommandField>
        </Fields>
    </asp:DetailsView>
    </div>



    <asp:EntityDataSource ID="DSThucDon" runat="server" 
        ConnectionString="name=EDiamondEntities" 
        DefaultContainerName="EDiamondEntities" EnableFlattening="False" 
        EntitySetName="SanPhams" onupdated="DSThucDon_Updated" 
        onupdating="DSThucDon_Updating" Where="it.SanPhamID == @idTD">
        <WhereParameters>
            <asp:QueryStringParameter Name="idTD" QueryStringField="idTD" Type="Int32" />
        </WhereParameters>
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="DSNhomMon" runat="server" 
        ConnectionString="name=EDiamondEntities" 
        DefaultContainerName="EDiamondEntities" EnableFlattening="False" 
        EntitySetName="LoaiSanPhams" Where="">
        <WhereParameters>
            <asp:QueryStringParameter Name="idTD" QueryStringField="idTD" Type="Int32" />
        </WhereParameters>
    </asp:EntityDataSource>
</asp:Content>

